Skip to content

Conversation

@dylan-jung
Copy link
Contributor

@dylan-jung dylan-jung commented Dec 3, 2025

답안 제출 문제

작성자 체크 리스트

  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

@radiantchoi radiantchoi self-requested a review December 3, 2025 09:08
Copy link
Contributor

@radiantchoi radiantchoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요! 이번 주 리뷰를 해 드리게 되었습니다. 제가 C++을 처음 읽어보네요..! 한편 저도 푼 것에 대해서 경험을 바탕으로 이런저런 이야기를 나눠볼 수 있겠습니다만, 풀지 못한 혹은 않은 것에 대해서는 제 생각이 미치지 못 할 수 있습니다. 상기 사유로 인해 피드백이 부족할 수 있는 부분은 양해 부탁드립니다. 이번주도 고생 많으셨습니다!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dp 배열을 무한대로 초기화하셨군요! 대개 이런 경우 방문 처리를 해야 한다고 하나요.. 저는 이 문제를 바로 풀지는 못하고 태그를 토대로 방법을 유추만 해 봤는데, dp 배열을 -1로 초기화했습니다. 결국 if가 반환할 때랑 값을 갱신할 때, 어디에 들어가냐 문제인 것 같기는 해요.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깊이를 나타내는 인수를 들고 dfs하는 문제였죠. 직관적으로 풀어주신 듯 합니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leetcode 특유의 리스트 관리 방법에서 제가 꽤 어려움을 많이 겪었던 기억이 납니다. 결국 연결 리스트는 참조 기반으로 이루어지고, 포인터를 기반으로 더미 노드를 맨 앞에 둔 다음 반환시 next를 사용한다는 것 말이죠.. 리스트1과 리스트2 중 남는 것을 이어붙이는 부분에서 매우 깔끔하게 해 주셨다는 생각이 듭니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

visited 방식을 사용하셨군요! 탐색 문제에서는 visited 배열의 사용을 생활화해야 하나, 하는 생각이 듭니다. 저는 주어진 배열의 글자를 특수문자로 바꾸고 원상복구 시켜가면서 백트래킹을 사용했는데 아무래도 좀 헷갈리더군요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그것도 백트래킹에서 사용하기에 좋은 방법인 듯합니다!

그 방법에서 잠깐 생각해보니 다음과 같은 탐색 상황일 때,

char mem = arr[i][j];
arr[i][j] = '+'
dfs(next)
arr[i][j] = mem;

처럼 결국 mem이라는 변수를 결국 만들어서 스택 영역에 저장해야한다는 점 때문에 bool 배열인 visited가 살짝 더 좋아보이긴 하네요. 사소한 차이라서 편한거 쓰서도 좋을 것 같습니다!

@dylan-jung dylan-jung merged commit 541e16b into DaleStudy:main Dec 6, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 6기 Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

2 participants